From c362c8308e21c18dfee49f72e6a411309b0baea6 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 9 Feb 2006 00:27:52 +0100 Subject: [PATCH] Fix x86_64 CPU hotplug by paravirtualizing the play_dead() function. Also fix the i386 play_dead() function to call idle_task_exit(), which ensures the CPU exits while running the init_mm. Otherwise other tasks may get stuck. Signed-off-by: Ryan Grimm Signed-off-by: Keir Fraser --- buildconfigs/linux-defconfig_xenU_x86_64 | 2 +- buildconfigs/linux-defconfig_xen_x86_64 | 2 +- .../arch/i386/kernel/process-xen.c | 1 + .../arch/x86_64/kernel/process-xen.c | 17 ++--------------- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/buildconfigs/linux-defconfig_xenU_x86_64 b/buildconfigs/linux-defconfig_xenU_x86_64 index 288c996169..e2cd16bf93 100644 --- a/buildconfigs/linux-defconfig_xenU_x86_64 +++ b/buildconfigs/linux-defconfig_xenU_x86_64 @@ -127,7 +127,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y # CONFIG_SPARSEMEM_STATIC is not set CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_NR_CPUS=8 -# CONFIG_HOTPLUG_CPU is not set +CONFIG_HOTPLUG_CPU=y CONFIG_SWIOTLB=y # CONFIG_CRASH_DUMP is not set CONFIG_PHYSICAL_START=0x100000 diff --git a/buildconfigs/linux-defconfig_xen_x86_64 b/buildconfigs/linux-defconfig_xen_x86_64 index 58f18657c8..1f4a66a89b 100644 --- a/buildconfigs/linux-defconfig_xen_x86_64 +++ b/buildconfigs/linux-defconfig_xen_x86_64 @@ -130,7 +130,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y # CONFIG_SPARSEMEM_STATIC is not set CONFIG_SPLIT_PTLOCK_CPUS=4096 CONFIG_NR_CPUS=8 -# CONFIG_HOTPLUG_CPU is not set +CONFIG_HOTPLUG_CPU=y CONFIG_SWIOTLB=y # CONFIG_CRASH_DUMP is not set CONFIG_PHYSICAL_START=0x100000 diff --git a/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c b/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c index 66fbe21e5a..a6f5ac0bd2 100644 --- a/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c +++ b/linux-2.6-xen-sparse/arch/i386/kernel/process-xen.c @@ -126,6 +126,7 @@ EXPORT_SYMBOL(default_idle); #ifdef CONFIG_HOTPLUG_CPU static inline void play_dead(void) { + idle_task_exit(); HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL); local_irq_enable(); } diff --git a/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c b/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c index 15671852d2..096aab6eef 100644 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/process-xen.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -144,21 +145,7 @@ DECLARE_PER_CPU(int, cpu_state); static inline void play_dead(void) { idle_task_exit(); - wbinvd(); - mb(); - /* Ack it */ - __get_cpu_var(cpu_state) = CPU_DEAD; - - /* We shouldn't have to disable interrupts while dead, but - * some interrupts just don't seem to go away, and this makes - * it "work" for testing purposes. */ - /* Death loop */ - while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE) - HYPERVISOR_sched_op(SCHEDOP_yield, 0); - - local_irq_disable(); - __flush_tlb_all(); - cpu_set(smp_processor_id(), cpu_online_map); + HYPERVISOR_vcpu_op(VCPUOP_down, smp_processor_id(), NULL); local_irq_enable(); } #else -- 2.30.2